package logic

import (
	"box-ma-fresh/boxrpc/boxrpc"
	"box-ma-fresh/boxrpc/internal/svc"
	"box-ma-fresh/mysql/model"
	"context"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodsDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodsDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsDelLogic {
	return &GoodsDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 商品删除
func (l *GoodsDelLogic) GoodsDel(in *boxrpc.GoodsDeltRequest) (*boxrpc.GoodsDelResponse, error) {
	// todo: add your logic here and delete this line

	var goods model.BoxGoods
	err := goods.GoodeDelById(model.DB, in.GoodsId)
	if err != nil {
		return nil, err
	}

	return &boxrpc.GoodsDelResponse{}, nil
}
